package com.xdxc.service.impl;


import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xdxc.mapper.ScoringTaskMapper;

import com.xdxc.model.entity.ScoringTask;
import com.xdxc.model.form.ExamProgressForm;

import com.xdxc.service.serviceinterface.ScoringTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;


@Service
@RequiredArgsConstructor
public class ScoringTaskServiceImpl extends ServiceImpl<ScoringTaskMapper, ScoringTask> implements ScoringTaskService {





    @Override
    public ExamProgressForm getExamProgressFormData(ExamProgressForm examProgressForm) {
        return null;
    }

    /**
     * 获取mnvcvbn表单数据
     *
     * @param id mnvcvbnID
     * @return
     */
    @Override
    public ExamProgressForm getExamProgressFormData(Long id) {
        ScoringTask entity = this.getById(id);
        if (entity!=null){

        }

        return null;
    }

    @Override
    public ExamProgressForm getExamProgress(ExamProgressForm examProgressForm) {
        ScoringTask entity = this.getById(examProgressForm.getExamId());
        if (entity!=null){
            this.save(ScoringTask.builder()
                    .examName(examProgressForm.getExamName()).isEnd(0).build());
        }
        ScoringTask entity1 = this.getById(examProgressForm.getExamId());
        return null;
    }
    /**
     * 新增mnvcvbn
     *
     * @param formData mnvcvbn表单对象
     * @return
     */
    @Override
    public boolean saveExamProgress(ExamProgressForm formData) {

        return false;
    }

    /**
     * 更新mnvcvbn
     *
     * @param id   mnvcvbnID
     * @param formData mnvcvbn表单对象
     * @return
     */
    @Override
    public boolean updateExamProgress(Long id,ExamProgressForm formData) {
        return false;
    }

    /**
     * 删除mnvcvbn
     *
     * @param ids mnvcvbnID，多个以英文逗号(,)分割
     * @return
     */
    @Override
    public boolean deleteExamProgresss(String ids) {
        Assert.isTrue(StrUtil.isNotBlank(ids), "删除的mnvcvbn数据为空");
        // 逻辑删除
        List<Long> idList = Arrays.stream(ids.split(","))
                .map(Long::parseLong)
                .toList();
        return this.removeByIds(idList);
    }


}
